<!DOCTYPE html>
<html>
<head>
<#include "../common/head.ftl">
</head>
<body>
<div class="wrapper">
    <div class="section">
        <div class="search-wrapper clearfix">
            <div class="pull-left">
                <form class="form-inline" id="search_form">
                    <div class="form-group">
                        <input type="text" name="keywords" class="form-control" placeholder="请输入名称或标识" maxlength="20">
                        <input type="hidden" name="pid" class="form-control">
                    </div>
                    <button type="button" class="btn btn-default search-btn"><span class="fa fa-search"></span>&nbsp;查询</button>
                    <button type="reset" class="btn btn-default"><span class="fa fa-undo"></span>&nbsp;重置</button>
                </form>
            </div>
            <div class="pull-right">
                <button type="button" id="add_btn" class="btn btn-default"><span class="fa fa-plus"></span>&nbsp;新增</button>
            </div>
        </div>
        <div class="grid-wrapper">
            <table id="grid"></table>
            <div id="pager"></div>
        </div>
    </div>
</div>
<#include "../common/tab_oper.ftl">
</body>
<#include "../common/scripts.ftl">
<script type="text/javascript">
    var grid;
    grid = $("#grid").jqGrid({
        height: Public._win.gridBigHeight(),
        url: "sys_message/list/page",
        pager: "#pager",
        colModel: [
            {label:"ID",name:"m.id",key:true,hidden:true},
            {label:"名称",name:"m.name",width:40},
            {label:"类型",name:"m.type",width:20,formatter:function(val){return val==0?"<span class='text-primary'>菜单</span>":"<span class='text-success'>资源</span>";}},
            {label:"层级",name:"m.level",width:20},
            {label:"图标",name:"m.icon",width:40,formatter:function(val,opt,obj){return val?("<span class='"+val+"'></span>&nbsp;（"+val+"）"):"";}},
            {label:"URL",name:"m.link",width:60},
            {label:"权限标识",name:"m.permission",width:40},
            {label:"排序",name:"m.priority",width:20}
        ],
        loadComplete : function() {

        },
        gridComplete : function() {
            setTimeout(function() {
                Public._grid.autoSize(grid);
            }, 10);
        }
    });
    $(".search-btn").on("click",function(){
        grid.jqGrid("setGridParam",{postData:$("#search_form").serializeObject(),page:1}).trigger("reloadGrid");
    });
</script>
</html>